home *** CD-ROM | disk | FTP | other *** search
/ Sound Fx / Sound Fx.iso / Software / UNZIPED / DWSTKW / PAS / DWS.PAS next >
Encoding:
Pascal/Delphi Source File  |  1996-07-08  |  21.9 KB  |  629 lines

  1. {***************************************************************************
  2. File:      dws.pas
  3. Version:   1.00
  4. Tab stops: none
  5. Project:   DiamondWare's Sound ToolKit for Windows
  6. Copyright: 1994-1996 DiamondWare, Ltd.  All rights reserved.
  7. Written:   by David Bollinger (based on dws.h for WIN-STK)
  8. Purpose:   Contains declarations for the DW Sound ToolKit for Windows
  9. History:   96/02/24 DB Started
  10.            96/03/27 JCL Finalized for 1.0
  11.            96/04/14 JCL Finalized for 1.01
  12.            96/05/13 JCL Finalized for 1.1 (no changes)
  13.            96/05/27 JCL Finalized for 1.11
  14.            96/05/27 JCL Finalized for 1.2 (no changes)
  15.  
  16. *Permission is expressly granted to use this program or any derivitive made
  17.  from it to registered users of the WIN-STK.
  18. ***************************************************************************}
  19.  
  20.  
  21.  
  22. Unit DWS;
  23.  
  24.  
  25. interface
  26.  
  27. uses WinTypes;
  28.  
  29. const
  30.  
  31. {***************************************************************************}
  32.   {
  33.    . If a call to a dws_ function returns 0, then this is an
  34.    . indication that an error has occured.  Call dws_ErrNo to see which
  35.    . one.  The following series of constants is the complete list of
  36.    . possible return values for dws_ErrNo.
  37.   }
  38.   dws_EZERO                      =   0;  { no error }
  39.  
  40.   { The following 6 errors may be triggered by any dws_ function }
  41.   dws_NOTINITTED                 =   1;
  42.   dws_ALREADYINITTED             =   2;
  43.   dws_NOTSUPPORTED               =   3;
  44.   dws_INTERNALERROR              =   4;
  45.   dws_INVALIDPOINTER             =   5;
  46.   dws_RESOURCEINUSE              =   6;
  47.   dws_MEMORYALLOCFAILED          =   7;
  48.   dws_SETEVENTFAILED             =   8;
  49.  
  50.   {
  51.    . dws_BUSY may be triggered during a call to a dws_ function, if any
  52.    . dws_ function is already executing.  Ordinarily, this should never
  53.    . occur.
  54.   }
  55.   dws_BUSY                       =   9;
  56.  
  57.   { This error may be triggered only by dws_Init }
  58.   dws_Init_BUFTOOSMALL           = 101;
  59.  
  60.   { The following 3 errors may be triggered by any dws_D (dig) function }
  61.   dws_D_NOTADWD                  = 201;
  62.   dws_D_NOTSUPPORTEDVER          = 202;
  63.   dws_D_BADDPLAY                 = 203;
  64.  
  65.   { The following error may be triggered by dws_DPlay }
  66.   dws_DPlay_NOSPACEFORSOUND      = 251;
  67.  
  68.   { These 2 errors may be triggered by dws_WAV2DWD }
  69.   dws_WAV2DWD_NOTAWAVE           = 301;
  70.   dws_WAV2DWD_UNSUPPORTEDFORMAT  = 302;
  71.  
  72.   { The following error may be triggered by any dws_M (music) function }
  73.   dws_M_BADMPLAY                 = 401;
  74.  
  75.  
  76. {-----------------------------------------------------------------------------}
  77.   {
  78.    . This section defines bitfields which are used by various dws_
  79.    . functions.  Each bit in a bitfield, by definition, may be set/reset
  80.    . independantly of all other bits.
  81.   }
  82.  
  83.   { flags for muscaps value of dws_DETECTRESULTS record }
  84.   dws_muscap_NONE      = $0000; { no music playback }
  85.   dws_muscap_MIDIPORT  = $0001; { output port }
  86.   dws_muscap_SYNTH     = $0002; { generic int synth }
  87.   dws_muscap_SQSYNTH   = $0004; { square wave int synth }
  88.   dws_muscap_FMSYNTH   = $0008; { FM int synth }
  89.   dws_muscap_MAPPER    = $0010; { MIDI mapper }
  90.   dws_muscap_ANY       = $001F; { mask of all available modes }
  91.  
  92.   dws_digcap_NONE        = $0000; { no digitized sound playback }
  93.   dws_digcap_11025_08_1  = $0001; { 11kHz, 8-bit, mono }
  94.   dws_digcap_11025_08_2  = $0002; { 11kHz, 8-bit, stereo }
  95.   dws_digcap_11025_16_1  = $0004; { 11kHz, 16-bit, mono }
  96.   dws_digcap_11025_16_2  = $0008; { 11kHz, 16-bit, stereo }
  97.   dws_digcap_22050_08_1  = $0010; { 22kHz, 8-bit, mono }
  98.   dws_digcap_22050_08_2  = $0020; { 22kHz, 8-bit, stereo }
  99.   dws_digcap_22050_16_1  = $0040; { 22kHz, 16-bit, mono }
  100.   dws_digcap_22050_16_2  = $0080; { 22kHz, 16-bit, stereo }
  101.   dws_digcap_44100_08_1  = $0100; { 44kHz, 8-bit, mono }
  102.   dws_digcap_44100_08_2  = $0200; { 44kHz, 8-bit, stereo }
  103.   dws_digcap_44100_16_1  = $0400; { 44kHz, 16-bit, mono }
  104.   dws_digcap_44100_16_2  = $0800; { 44kHz, 16-bit, stereo }
  105.   dws_digcap_ANY         = $0FFF; { mask of all available modes }
  106.  
  107.   {
  108.    . The following constants are bitfields used in the flags field in the
  109.    . dws_IDEAL record.
  110.    .
  111.    . SWAPLR should be used to compensate for downstream electronics which
  112.    . switch the left and right field.
  113.    .
  114.    . Since pitch and volume change both require some additional CPU time,
  115.    . you may want to disable them for slow machines and enable for fast
  116.    . machines.  This is an easy way for you to do this, without changing
  117.    . your program around.
  118.    .
  119.    . Notes:
  120.    .   1) Pitch change is slower than volume change.
  121.    .   2) Pitch decrease (dws_DPLAY.pitch > dws_IDENTITY) is slower than
  122.    .      pitch increase
  123.    .   3) When the source sound, or the STK, is 8-bit, raising the volume
  124.    .      is slower than lowering it.  Otherwise both are equal.
  125.   }
  126.   dws_ideal_NONE           = $0000;  { this is the normal case }
  127.   dws_ideal_SWAPLR         = $0001;  { swap Left & Right on playback }
  128.   dws_ideal_DISABLEPITCH   = $0002;  { disable the pitch feature }
  129.   dws_ideal_DISABLEVOLUME  = $0004;  { disable the volume feature }
  130.   dws_ideal_MAXSPEED       = $0006;  { use this for very slow machines }
  131.  
  132.   {
  133.    . These are the flag bitfields for the dws_DPLAY record.
  134.    . Each corresponds to one field in the record.
  135.   }
  136.   dws_dplay_SND         = $00000001;
  137.   dws_dplay_COUNT       = $00000002;
  138.   dws_dplay_PRIORITY    = $00000004;
  139.   dws_dplay_PRESND      = $00000008;
  140.   dws_dplay_SOUNDNUM    = $00000010;
  141.   dws_dplay_LVOL        = $00000020;
  142.   dws_dplay_RVOL        = $00000040;
  143.   dws_dplay_PITCH       = $00000080;
  144.   dws_dplay_CALLBACK    = $00000100;
  145.   dws_dplay_SYNCHRONOUS = $00000200;
  146.   dws_dplay_FIRSTSAMPLE = $00000400;
  147.   dws_dplay_CURSAMPLE   = $00000800;
  148.   dws_dplay_LASTSAMPLE  = $00001000;
  149.  
  150.   { The following 2 consts indicate the status of music playback }
  151.   dws_MSONGSTATUSPLAYING           =   $0001;
  152.   dws_MSONGSTATUSPAUSED            =   $0002;
  153.  
  154.  
  155. {---------------------------------------------------------------------------}
  156.   {
  157.    . When the WIN-STK sends a message to your window, the lParam field
  158.    . indicates the purpose of the message.
  159.   }
  160.   dws_event_SOUNDCOMPLETE  = $0001;
  161.   dws_event_SOUNDSTARTED   = $0002;
  162.   dws_event_SOUNDABORTED   = $0003;
  163.  
  164.  
  165.   { For no change in volume level or pitch }
  166.   dws_IDENTITY  = $100;
  167.  
  168.   { Default priority, if not specified in call to dws_DPlay }
  169.   dws_NORMALPRIORITY  = $1000;
  170.  
  171.  
  172.  
  173. {*****************************************************************************}
  174.  
  175. type
  176.  
  177.   { For some reason Delphi 1.0 does not define a DWORD in WinTypes! }
  178.   {$ifdef WIN32}
  179.      PDWORD = ^DWORD;
  180.   {$else}
  181.      DWORD = longint;
  182.      PDWORD = ^DWORD;
  183.   {$endif}
  184.  
  185.  
  186.  
  187.   {
  188.    . This section declares the record types used by the STK.  In each
  189.    . case, the user must create an instance of the record prior to making
  190.    . a call to any STK function which takes a pointer to it.  The STK does
  191.    . not keep a pointer to any of these records internally; after the call
  192.    . returns, you may deallocate it, if you wish.
  193.    .
  194.    . NB: The STK _does_ keep pointers to digitized sound buffers!
  195.   }
  196.  
  197.   {
  198.    . A pointer to this record is passed to dws_DetectHardWare, which fills
  199.    . it in.  It should then be passed to dws_Init.  If you plan on writing
  200.    . this record out to a file, it's important that you write the entire
  201.    . contents.  There is information (for internal STK use only) in the
  202.    . reserved[] field!
  203.   }
  204.   dws_DETECTRESULTS = packed record
  205.     { This field indicates which music capabilities are available, if any }
  206.     muscaps : DWORD;     { see dws_muscap_xxxxxx constants above }
  207.  
  208.     { This field indicates which dig capabilities are available, if any }
  209.     digcaps : DWORD;     { see dws_digcap_xxxxxx constants above }
  210.  
  211.     { The next 4 fields should not be modified, except with great caution }
  212.     digbfr : DWORD;      { minimum buffer size }
  213.  
  214.     reserved : array [0..19] of BYTE;
  215.   end;
  216.  
  217.  
  218.   {
  219.    . A pointer to this record is passed as a parameter to dws_Init.  This
  220.    . record allows the program to let the STK know what capabilities it
  221.    . will actually use.
  222.   }
  223.   dws_IDEAL = packed record
  224.     flags : DWORD;        { use combination of dws_ideal_xxxx }
  225.  
  226.     mustyp : DWORD;       { use dws_muscap_xxxxxx (mode) to select }
  227.  
  228.     digtyp : DWORD;       { use dws_digcap_xxxxxx (mode) to select }
  229.     dignvoices : WORD;    { maximum number of digitized voices you'll use }
  230.  
  231.     reserved : array [0..17] of BYTE;
  232.   end;
  233.  
  234.  
  235.   {
  236.    . A pointer to this record is passed to dws_DPlay.
  237.    .
  238.    . NB: The soundnum field is filled in by dws_DPlay as a return value.
  239.   }
  240.   dws_DPLAYREC = packed record
  241.     flags : DWORD;       { flag indicates active fields in record         }
  242.     snd : PBYTE;         { pointer to buffer which holds a .DWD file      }
  243.     count : WORD;        { number of times to play, or 0=infinite loop    }
  244.     priority : WORD;     { higher numbers mean higher priority            }
  245.     presnd : WORD;       { soundnum to sequence sound _after_             }
  246.     soundnum : WORD;     { dws_DPlay returns a snd number from 10-65535   }
  247.     lvol : WORD;         { 0-65535, 0 is off, 256 is dws_IDENTITY         }
  248.     rvol : WORD;         { if the output is mono lvol & rvol are averaged }
  249.     pitch : WORD;        { 1-65535, 256 is dws_IDENTITY (0 is unuseable)  }
  250.     dummy : WORD;        { added to insure DWORD alignment                }
  251.     hwndmsg : HWND;      { handle of window to which to send msg          }
  252.  
  253.     ($ifdef WIN32)
  254.       wmessage : DWORD;  { message sent to window hwndmsg                 }
  255.     {$else}
  256.       wmessage : WORD;   { message sent to window hwndmsg                 }
  257.     {$endif}
  258.  
  259.     firstsample : DWORD; { first sample to play from buffer               }
  260.     cursample : DWORD;   { current sample to play from buffer             }
  261.     lastsample : DWORD;  { last sample to play from buffer                }
  262.  
  263.     {$ifdef WIN32}
  264.       reserved : array [0..3] of BYTE;
  265.     {$else}
  266.       reserved : array [0..7] of BYTE;
  267.     {$endif}
  268.   end;
  269.  
  270.   { A pointer to this record is passed to dws_MPlay. }
  271.   dws_MPLAYREC = packed record
  272.     track : PBYTE;        { ptr to NULL-terminated .MID file name string }
  273.     count : WORD;         { number of times to play, or 0=infinite loop }
  274.  
  275.     reserved : array [0..9] of BYTE;
  276.   end;
  277.  
  278. {$ifdef WIN32}
  279. {***************************************************************************}
  280.   { This section prototypes the WIN-STK functions }
  281.  
  282.  
  283.  
  284.   {
  285.    . This function is callable at any time.  It returns the number of the
  286.    . last error which occured.
  287.   }
  288.   function dws_ErrNo : WORD; stdcall;
  289.  
  290. {*****************************************************************************}
  291.  
  292.  
  293.   {
  294.    . Each function in this section has a boolean return value.  A 0
  295.    . indicates that the function failed in some way.  In this case, call
  296.    . dws_ErrNo to get the specific error.  Otherwise, a return value of 1
  297.    . indicates that all is well.
  298.   }
  299.   function dws_DetectHardWare(var dr: dws_DETECTRESULTS) : WORDBOOL; stdcall;
  300.  
  301.   function dws_Init(var dr: dws_DETECTRESULTS;
  302.                     var ideal: dws_IDEAL) : WORDBOOL; stdcall;
  303.  
  304.   {
  305.    . If the program has called dws_Init, it _MUST_ call dws_Kill before it
  306.    . terminates.
  307.   }
  308.   function dws_Kill : WORDBOOL; stdcall;
  309.  
  310.  
  311.   {
  312.    . The following function is the digital mixer of the STK.  A
  313.    . value of 0 is off; dws_IDENTITY is normal, and 0xffff is maximum
  314.    . volume (grossly distorted).
  315.   }
  316.   function dws_XDig(lvolume, rvolume: WORD) : WORDBOOL; stdcall;
  317.  
  318.  
  319.   {
  320.    . The following 9 functions comprise the digitized sound functions of
  321.    . the STK.  See the documentation for complete details.
  322.   }
  323.   function dws_DPlay(var dplay: dws_DPLAYREC) : WORDBOOL; stdcall;
  324.  
  325.   {
  326.    . Allows you to change the following items:
  327.    .   count
  328.    .   priority
  329.    .   lvol
  330.    .   rvol
  331.    .   pitch
  332.    .   hwndmsg and message (simultaneously)
  333.   }
  334.   function dws_DSetInfo(var dplay1 : dws_DPLAYREC;
  335.                         var dplay2 : dws_DPLAYREC) : WORDBOOL; stdcall;
  336.  
  337.   {
  338.    . Takes a ptr to a dws_DPLAY record; soundnum specifies which sound.
  339.    .
  340.    . Can retrieve the current values for any or all of the following:
  341.    .   snd
  342.    .   count
  343.    .   priority
  344.    .   presnd
  345.    .   lvol
  346.    .   rvol
  347.    .   pitch
  348.    .   hwndmsg and message (simultaneously)
  349.   }
  350.   function dws_DGetInfo(var dplay1 : dws_DPLAYREC;
  351.                         var dplay2 : dws_DPLAYREC) : WORDBOOL; stdcall;
  352.  
  353.   { Callable at any time--even before dws_Init or after dws_Kill }
  354.   function dws_DGetRateFromDWD(snd: PBYTE; var result: WORD) : WORDBOOL; stdcall;
  355.  
  356.   function dws_DDiscard(soundnum: WORD) : WORDBOOL; stdcall;
  357.  
  358.   function dws_DDiscardAO(snd: PBYTE) : WORDBOOL; stdcall;
  359.  
  360.   function dws_DClear : WORDBOOL; stdcall;         { global }
  361.  
  362.   function dws_DPause : WORDBOOL; stdcall;         { global }
  363.  
  364.   function dws_DUnPause : WORDBOOL; stdcall;       { global }
  365.  
  366.   {
  367.    . Converts a .WAV buffer to a .DWD buffer
  368.    .
  369.    . This function has two usages.  In the first, pass the wave pointer, the
  370.    . wave length in *len and a NIL pointer for dwd.  The routine will return
  371.    . the length of the buffer required to hold the resulting DWD in *len.  In
  372.    . the second usage, allocate a buffer of the correct size and pass its
  373.    . address in dwd.  Make sure you pass the wave pointer in wave and the size
  374.    . of the wave in *len.  It will then perform the conversion, returning the
  375.    . number of bytes used in *len.
  376.   }
  377.   function dws_WAV2DWD(wave: PBYTE; var len: DWORD;
  378.                        snd: PBYTE) : WORDBOOL; stdcall;
  379.  
  380.   { The following 5 functions comprise the music functions of the STK. }
  381.   function dws_MPlay(var mplay: dws_MPLAYREC) : WORDBOOL; stdcall;
  382.  
  383.   function dws_MSongStatus(var result: WORD) : WORDBOOL; stdcall;
  384.  
  385.   function dws_MClear : WORDBOOL; stdcall;
  386.  
  387.   function dws_MPause : WORDBOOL; stdcall;
  388.  
  389.   function dws_MUnPause : WORDBOOL; stdcall;
  390.  
  391.   {
  392.    . If your 16-bit application can't yield CPU time to the system, it must
  393.    . call this function periodically to prevent the sound from pausing.
  394.    . This is not required for 32-bit applications, but the function is
  395.    . supported for compatibility.
  396.   }
  397.   function dws_Update : WORDBOOL; stdcall;
  398.  
  399. implementation
  400.  
  401. const
  402.   DWSDLL = 'DWSW32';
  403.  
  404.   function dws_ErrNo : WORD; stdcall;
  405.            external DWSDLL;
  406.   function dws_DetectHardWare(var dr: dws_DETECTRESULTS) : WORDBOOL; stdcall;
  407.            external DWSDLL;
  408.   function dws_Init(var dr: dws_DETECTRESULTS;
  409.                     var ideal: dws_IDEAL) : WORDBOOL; stdcall;
  410.            external DWSDLL;
  411.   function dws_Kill : WORDBOOL; stdcall;
  412.            external DWSDLL;
  413.   function dws_XDig(lvolume, rvolume: WORD) : WORDBOOL; stdcall;
  414.            external DWSDLL;
  415.   function dws_DPlay(var dplay: dws_DPLAYREC) : WORDBOOL; stdcall;
  416.            external DWSDLL;
  417.   function dws_DSetInfo(var dplay1 : dws_DPLAYREC;
  418.                         var dplay2 : dws_DPLAYREC) : WORDBOOL; stdcall;
  419.            external DWSDLL;
  420.   function dws_DGetInfo(var dplay1 : dws_DPLAYREC;
  421.                         var dplay2 : dws_DPLAYREC) : WORDBOOL; stdcall;
  422.            external DWSDLL;
  423.   function dws_DGetRateFromDWD(snd: PBYTE; var result: WORD) : WORDBOOL; stdcall;
  424.            external DWSDLL;
  425.   function dws_DDiscard(soundnum: WORD) : WORDBOOL; stdcall;
  426.            external DWSDLL;
  427.   function dws_DDiscardAO(snd: PBYTE) : WORDBOOL; stdcall;
  428.            external DWSDLL;
  429.   function dws_DClear : WORDBOOL; stdcall;
  430.            external DWSDLL;
  431.   function dws_DPause : WORDBOOL; stdcall;
  432.            external DWSDLL;
  433.   function dws_DUnPause : WORDBOOL; stdcall;
  434.            external DWSDLL;
  435.   function dws_WAV2DWD(wave: PBYTE; var len: DWORD;
  436.                        snd: PBYTE) : WORDBOOL; stdcall;
  437.            external DWSDLL;
  438.   function dws_MPlay(var mplay: dws_MPLAYREC) : WORDBOOL; stdcall;
  439.            external DWSDLL;
  440.   function dws_MSongStatus(var result: WORD) : WORDBOOL; stdcall;
  441.            external DWSDLL;
  442.   function dws_MClear : WORDBOOL; stdcall;
  443.            external DWSDLL;
  444.   function dws_MPause : WORDBOOL; stdcall;
  445.            external DWSDLL;
  446.   function dws_MUnPause : WORDBOOL; stdcall;
  447.            external DWSDLL;
  448.   function dws_Update : WORDBOOL; stdcall;
  449.            external DWSDLL;
  450.  
  451. {$else}
  452. {***************************************************************************}
  453.   { This section prototypes the WIN-STK functions }
  454.  
  455.  
  456.  
  457.   {
  458.    . This function is callable at any time.  It returns the number of the
  459.    . last error which occured.
  460.   }
  461.   function dws_ErrNo : WORD;
  462.  
  463. {*****************************************************************************}
  464.  
  465.  
  466.   {
  467.    . Each function in this section has a boolean return value.  A 0
  468.    . indicates that the function failed in some way.  In this case, call
  469.    . dws_ErrNo to get the specific error.  Otherwise, a return value of 1
  470.    . indicates that all is well.
  471.   }
  472.   function dws_DetectHardWare(var dr: dws_DETECTRESULTS) : WORDBOOL;
  473.  
  474.   function dws_Init(var dr: dws_DETECTRESULTS;
  475.                     var ideal: dws_IDEAL) : WORDBOOL;
  476.  
  477.   {
  478.    . If the program has called dws_Init, it _MUST_ call dws_Kill before it
  479.    . terminates.
  480.   }
  481.   function dws_Kill : WORDBOOL;
  482.  
  483.  
  484.   {
  485.    . The following function is the digital mixer of the STK.  A
  486.    . value of 0 is off; dws_IDENTITY is normal, and 0xffff is maximum
  487.    . volume (grossly distorted).
  488.   }
  489.   function dws_XDig(lvolume, rvolume: WORD) : WORDBOOL;
  490.  
  491.  
  492.   {
  493.    . The following 9 functions comprise the digitized sound functions of
  494.    . the STK.  See the documentation for complete details.
  495.   }
  496.   function dws_DPlay(var dplay: dws_DPLAYREC) : WORDBOOL;
  497.  
  498.   {
  499.    . Allows you to change the following items:
  500.    .   count
  501.    .   priority
  502.    .   lvol
  503.    .   rvol
  504.    .   pitch
  505.    .   hwndmsg and message (simultaneously)
  506.   }
  507.   function dws_DSetInfo(var dplay1 : dws_DPLAYREC;
  508.                         var dplay2 : dws_DPLAYREC) : WORDBOOL;
  509.  
  510.   {
  511.    . Takes a ptr to a dws_DPLAY record; soundnum specifies which sound.
  512.    .
  513.    . Can retrieve the current values for any or all of the following:
  514.    .   snd
  515.    .   count
  516.    .   priority
  517.    .   presnd
  518.    .   lvol
  519.    .   rvol
  520.    .   pitch
  521.    .   hwndmsg and message (simultaneously)
  522.   }
  523.   function dws_DGetInfo(var dplay1 : dws_DPLAYREC;
  524.                         var dplay2 : dws_DPLAYREC) : WORDBOOL;
  525.  
  526.   { Callable at any time--even before dws_Init or after dws_Kill }
  527.   function dws_DGetRateFromDWD(snd: PBYTE; var result: WORD) : WORDBOOL;
  528.  
  529.   function dws_DDiscard(soundnum: WORD) : WORDBOOL;
  530.  
  531.   function dws_DDiscardAO(snd: PBYTE) : WORDBOOL;
  532.  
  533.   function dws_DClear : WORDBOOL;         { global }
  534.  
  535.   function dws_DPause : WORDBOOL;         { global }
  536.  
  537.   function dws_DUnPause : WORDBOOL;       { global }
  538.  
  539.   {
  540.    . Converts a .WAV buffer to a .DWD buffer
  541.    .
  542.    . This function has two usages.  In the first, pass the wave pointer, the
  543.    . wave length in *len and a NIL pointer for dwd.  The routine will return
  544.    . the length of the buffer required to hold the resulting DWD in *len.  In
  545.    . the second usage, allocate a buffer of the correct size and pass its
  546.    . address in dwd.  Make sure you pass the wave pointer in wave and the size
  547.    . of the wave in *len.  It will then perform the conversion, returning the
  548.    . number of bytes used in *len.
  549.   }
  550.   function dws_WAV2DWD(wave: PBYTE; var len: DWORD;
  551.                        snd: PBYTE) : WORDBOOL;
  552.  
  553.   { The following 5 functions comprise the music functions of the STK. }
  554.   function dws_MPlay(var mplay: dws_MPLAYREC) : WORDBOOL;
  555.  
  556.   function dws_MSongStatus(var result: WORD) : WORDBOOL;
  557.  
  558.   function dws_MClear : WORDBOOL;
  559.  
  560.   function dws_MPause : WORDBOOL;
  561.  
  562.   function dws_MUnPause : WORDBOOL;
  563.  
  564.   {
  565.    . If your 16-bit application can't yield CPU time to the system, it must
  566.    . call this function periodically to prevent the sound from pausing.
  567.    . This is not required for 32-bit applications, but the function is
  568.    . supported for compatibility.
  569.   }
  570.   function dws_Update : WORDBOOL;
  571.  
  572. implementation
  573.  
  574. const
  575.   DWSDLL = 'DWSW16';
  576.  
  577.   function dws_ErrNo : WORD;
  578.            external DWSDLL;
  579.   function dws_DetectHardWare(var dr: dws_DETECTRESULTS) : WORDBOOL;
  580.            external DWSDLL;
  581.   function dws_Init(var dr: dws_DETECTRESULTS;
  582.                     var ideal: dws_IDEAL) : WORDBOOL;
  583.            external DWSDLL;
  584.   function dws_Kill : WORDBOOL;
  585.            external DWSDLL;
  586.   function dws_XDig(lvolume, rvolume: WORD) : WORDBOOL;
  587.            external DWSDLL;
  588.   function dws_DPlay(var dplay: dws_DPLAYREC) : WORDBOOL;
  589.            external DWSDLL;
  590.   function dws_DSetInfo(var dplay1 : dws_DPLAYREC;
  591.                         var dplay2 : dws_DPLAYREC) : WORDBOOL;
  592.            external DWSDLL;
  593.   function dws_DGetInfo(var dplay1 : dws_DPLAYREC;
  594.                         var dplay2 : dws_DPLAYREC) : WORDBOOL;
  595.            external DWSDLL;
  596.   function dws_DGetRateFromDWD(snd: PBYTE; var result: WORD) : WORDBOOL;
  597.            external DWSDLL;
  598.   function dws_DDiscard(soundnum: WORD) : WORDBOOL;
  599.            external DWSDLL;
  600.   function dws_DDiscardAO(snd: PBYTE) : WORDBOOL;
  601.            external DWSDLL;
  602.   function dws_DClear : WORDBOOL;
  603.            external DWSDLL;
  604.   function dws_DPause : WORDBOOL;
  605.            external DWSDLL;
  606.   function dws_DUnPause : WORDBOOL;
  607.            external DWSDLL;
  608.   function dws_WAV2DWD(wave: PBYTE; var len: DWORD;
  609.                        snd: PBYTE) : WORDBOOL;
  610.            external DWSDLL;
  611.   function dws_MPlay(var mplay: dws_MPLAYREC) : WORDBOOL;
  612.            external DWSDLL;
  613.   function dws_MSongStatus(var result: WORD) : WORDBOOL;
  614.            external DWSDLL;
  615.   function dws_MClear : WORDBOOL;
  616.            external DWSDLL;
  617.   function dws_MPause : WORDBOOL;
  618.            external DWSDLL;
  619.   function dws_MUnPause : WORDBOOL;
  620.            external DWSDLL;
  621.   function dws_Update : WORDBOOL;
  622.            external DWSDLL;
  623. {$endif}
  624.  
  625. {***************************************************************************}
  626.  
  627.  
  628. end.
  629.